<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%--
  Created by IntelliJ IDEA.
  User: taohj
  Date: 2014/6/29
  Time: 18:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<c:set var="menu" value="none" scope="request"></c:set>
<c:set var="dashboardMenuTag" value="myorg" scope="request"/>
<!Doctype html>
<html>
<head>
    <base href="<%=basePath%>">
    <title>政府数据开放平台</title>
    <jsp:include page="../../../../commons/include.jsp"/>

    <link href="/resources/css/lib.css" rel="stylesheet">

    <script type="text/javascript">
        $(function () {
            $('.pagination > li').each(function () {
                $(this).on('click', function () {
                    $("input[type=hidden][name=page]").val($(this).attr('page'));
                    $("form").submit();
                })
            });

            $("tbody>tr").each(function () {

                var id = $(this).attr('dataid');
                var org=$("input[type=hidden][name=org]").val();
                var url="/front/my/org/dataset/data/audit";

                $(this).find('td:last>ul>li:first').next().on('click', function () {
                    location.href = url+'?org='+org+'&auditStatus=183&datas=' + id;
                })


                $(this).find('td:last>ul>li:last').on('click', function () {
                    location.href = url+'?org='+org+'&auditStatus=182&datas=' + id;
                })

            });
        });
    </script>
</head>
<body>

<jsp:include page="../../../../commons/top.jsp"/>
<div class="main">


    <jsp:include page="../../../../commons/dashboardMenu.jsp"/>


    <%-- <div style="padding: 20px;">
         <input name="dataset" type="hidden" value="${result.pageResult.t.dataset.id}">
         <input type="button" value="新增"
                onclick="location.href='/front/my/org/dataset/data/createV?dataset=${result.pageResult.t.dataset.id}'">
     </div>--%>


    <div style="padding:20px; ">
            <form action="/front/my/org/dataset/data/auditV" method="get">
            <input type="hidden" name="page" value="1">
            <input type="hidden" name="org" value="${requestScope.result.pageResult.t.dataset.org.id}">

            <table>
                <tr>
                    <td>标题：</td>
                    <td>
                        <input type="text" name="title">
                    </td>
                    <td width="10"></td>
                    <td>审批状态：</td>
                    <td>
                        <select name="auditStatus" dataSync='true' syncType='dictionary' dictionaryType="AUDIT_STATUS" selectValue="${requestScope.result.pageResult.t.auditStatus.id}">
                            <option value="">请选择</option>
                        </select>
                    </td>
                    <td width="10"></td>
                    <td>数据集：</td>
                    <td>
                        <select name="dataset" dataSync='true' style="width: 200px;" syncType='dataset' org="${requestScope.result.pageResult.t.dataset.org.id}"  selectValue="${requestScope.result.pageResult.t.dataset.id}">
                            <option value="">请选择</option>
                        </select>
                    </td>
                    <td width="20"></td>
                    <td><input type="submit" value="搜  索" style="height: 24px;"></td>
                </tr>
            </table>
        </form>
    </div>


        <div style="padding: 20px 20px">
            <span style="font-size: 16px;font-weight: bold;">共找到条${requestScope.result.pageResult.total}记录</span>
        </div>

    <div style="padding: 20px;min-height: 400px;">
        <table class="table">
            <thead>
            <tr style="text-align: left">
                <%-- <td width="20"></td>--%>
                <td style="width: 40px">序号</td>
                <td style="width: 150px">标题</td>
                <td style="width: 150px">数据集</td>
                <td style="width: 100px">审批状态</td>


                <td style="width: 60px">存储形式</td>

                <td style="width: 60px">是否公开</td>

                <td style="width: 100px">操作</td>
            </tr>
            </thead>

            <tbody>
            <c:forEach items="${requestScope.result.pageResult.rows}" var="data" varStatus="status">
                <tr dataid="${data.id}">
                        <%-- <td><input type="checkbox" style="width: 14px;height: 14px;margin-top: 8px;"></td>--%>
                    <td>${status.count+(requestScope.result.pageResult.page-1)*requestScope.result.pageResult.size}</td>
                    <td>${data.title}</td>
                    <td>${data.dataset.name}</td>
                    <td>${data.auditStatus.name}</td>


                    <td>${data.storage.name}</td>


                    <td>${data.visibility.name}</td>

                    <td>
                        <ul id="icons" class="ui-widget ui-helper-clearfix">
                            <li class="ui-state-default ui-corner-all" title="预览" href="${data.preview}" target="_blank"><span class="ui-icon ui-icon-mail-open"></span></li>
                            <li class="ui-state-default ui-corner-all" title="通过"><span class="ui-icon ui-icon-check"></span></li>
                            <li class="ui-state-default ui-corner-all" title="不通过"><span class="ui-icon ui-icon-closethick"></span></li>
                        </ul>
                </tr>
            </c:forEach>

            </tbody>
        </table>
    </div>


    <div>
        <ul class="pagination" style="margin: 20px 30px;">
            <li page="${requestScope.result.pageResult.startPage-1}">&laquo;</li>

            <c:forEach begin="${requestScope.result.pageResult.startPage}"
                       end="${requestScope.result.pageResult.endPage}" var="index">
                <li page="${index}" <c:if
                        test="${index==requestScope.result.pageResult.page}"> class="active" </c:if> >${index}
                </li>
            </c:forEach>

            <li page="${requestScope.result.pageResult.endPage+1}">&raquo;</li>
        </ul>

    </div>


</body>
</html>
